package pipeline;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.Pipeline;

/**
 * Pipeline
 * @author:         MI
 * @email:          448341911@qq.com
 * @createTime:     2025/8/18 14:10
 * @updateUser:     MI
 * @updateTime:     2025/8/18 14:10
 * @updateRemark:   修改内容
 * @version:        1.0
 */
public class PipelineSet {
    public static void main(String[] args) {
        Jedis jedis = new Jedis("192.168.110.36", 6379);
        // 关键步骤：进行密码认证（请替换为你的Redis实际密码）
        jedis.auth("seata@user123");
        Pipeline pipelined = jedis.pipelined();
        long t1 = System.currentTimeMillis();
        for (int i=0; i < 100000; i++) {
            pipelined.set("batch"+i,""+i);
        }
        pipelined.syncAndReturnAll();
        long t2 = System.currentTimeMillis();
        System.out.println("耗时："+(t2-t1)+"ms");
    }
}
